﻿#include "mouseact.h"

MouseAct::MouseAct(QObject *parent)
    : QObject{parent}
{}

void MouseAct::getClickedPos()
{
    GetCursorPos(&pos);
}

void MouseAct::doPressAct(int x, int y, int type_id)
{
    SetCursorPos(x, y);
    if (type_id == 1) {
        mouse_event(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_LEFTDOWN, x, y, 0, 0);
        mouse_event(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_LEFTUP, x, y, 0, 0);
    } else if (type_id == 2) {

    }
}

void MouseAct::doPressActCurrentPos(int type_id)
{
    SetCursorPos(pos.x, pos.y);
    if (type_id == 1) {
        mouse_event(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_LEFTDOWN, pos.x, pos.y, 0, 0);
        mouse_event(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_LEFTUP, pos.x, pos.y, 0, 0);
    } else if (type_id == 2) {

    }
}


